package itbour.onetouchshow.widget;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

import itbour.onetouchshow.R;


/**
 * Created by guoh on 2018/7/5.
 * 功能描述：
 * 需要的参数：
 */
public class VideoRecordProgress extends LinearLayout {

    private TextView tvSecond;
    private ProgressBar progressBar;

    public VideoRecordProgress(Context context) {
        super(context);
        initView(context);
    }

    public VideoRecordProgress(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    private void initView(Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.view_video_record_progress, this);
        tvSecond = view.findViewById(R.id.tv_second);
        progressBar = view.findViewById(R.id.v_progress);
    }

    public void setTotalCount(int total) {
        progressBar.setMax(total);
    }

    public void setProgress(int pro) {
        progressBar.setProgress(pro);
        tvSecond.setText(pro + "");
    }

    public void resetProgress() {
        progressBar.setProgress(0);
        tvSecond.setText(0 + "");
    }

}
